From: [email-masked] (Big Will Riker)
To: [email-masked]
Date: Tue, 9 Aug 1994 16:35:53 +0100

Here's a coupla statements which may prove useful to all you brilliant
Blitz coders out there.
Basically it performs the ColSplit command but on AGA displays.
Don't ask me why you need a display x2 as high, perhaps its AGA being
crummy. Perhaps its me being crummy. Anyway, enough of this crap.
Here it is.....

NEWTYPE .rgbcomp				; Cos blitz cant
  r.w						; pass >6 params
  g.w
  b.w
END NEWTYPE

DEFTYPE .rgbcomp agacolour1,agacolour2		; Start and End cols

; Pass the coplist number
; Plus y-start, y-end and a colour number
Statement AGAColSplit {clist.l,y1.w,y2.w,colnum.w}
  SHARED agacolour1,agacolour2
  r1.w=agacolour1\r
  g1.w=agacolour1\g
  b1.w=agacolour1\b
  r2.w=agacolour2\r
  g2.w=agacolour2\g
  b2.w=agacolour2\b
  rs.q=((r2-r1)/(y2-y1))
  gs.q=((g2-g1)/(y2-y1))
  bs.q=((b2-b1)/(y2-y1))		; Calculate step values
  rc.q=r1
  gc.q=g1
  bc.q=b1
  PaletteInfo 0				; Needed to get AGAPalRed etc
  ro.w=AGAPalRed(colnum)
  go.w=AGAPalGreen(colnum)
  bo.w=AGAPalBlue(colnum)		; Store the old values
  For h.w=y1 To y2			
     AGAPalRGB 0,colnum,Int(rc),Int(gc),Int(bc)
     CustomColors clist,8*(h-y1),h,0,colnum,1	; Dont ask me how...
     rc+rs		; Each instruction is 8 bytes (we hope)
     gc+gs
     bc+bs
  Next h
  AGAPalRGB 0,0,ro,go,bo			; Restore the originals
End Statement

Function.l CCSize {height.l}			; Used to calc
  Function Return height*8			; Size of CustomCop instructions
End Function

.e.g

	InitCopList  0,44,256*2,$10008,8,256,CCSize{256}
;The last parameter allocates memory for Custom copperlist instructions
;which (with no thanks to ACID) is used by CustomColors.

; for some unkown reason, we need to create the display twice as high
; but makes no difference to the display though
	agacolour1\r=0
	agacolour1\g=0
	agacolour1\b=0
	agacolour2\r=255
	agacolour2\g=255
	agacolour2\b=255
	AGAColSplit{0,0,255,0}		; Use coplist 0, from 0 to 255
					; using colour 0
	CreateDisplay 0

And there you go! Try it out and let us know if it works or not.